//
//  SettingViewController.m
//  LoveBeeProject
//
//  Created by 沈腾飞 on 2017/1/5.
//  Copyright © 2017年 斯芬克斯. All rights reserved.
//

#import "SettingViewController.h"
#import "AboutViewController.h"
#import "RenewViewController.h"

@interface SettingViewController () <UITableViewDataSource>

@end



@implementation SettingViewController {
    
    NSArray * _listArr;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    self.view.backgroundColor = [UIColor cz_randomColor];
    
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    
    _listArr = @[@"关于爱鲜蜂",@"版本更新"];
    
    //去除cell多余的线
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    
    //设置cell分割线到最左边
    self.tableView.separatorInset = UIEdgeInsetsZero;
    
    
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return _listArr.count;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString * cellID = @"cell_ID";
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellID];
    
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    


    
    if (indexPath.row == 0) {
        cell.textLabel.text = _listArr[0];
        
    } else {
        cell.textLabel.text = _listArr[1];
        
    }
    //设置cell分割线定到最左边
    
//    cell.preservesSuperviewLayoutMargins = NO;
//    cell.separatorInset = UIEdgeInsetsZero;
//    cell.layoutMargins = UIEdgeInsetsZero;
    
    return cell;
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        
        AboutViewController * aboutvc = [[AboutViewController alloc] init];
        [self.navigationController pushViewController:aboutvc animated:YES];
        //隐藏UINavigationBar
//        [self.navigationController setNavigationBarHidden:YES animated:YES];
    } else {
        
        RenewViewController * renewVC = [[RenewViewController alloc] init];
        [self.navigationController pushViewController:renewVC animated:YES];
    }
    //取消选中
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
}








- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
